package ym.ecrm.core.domain.systemManagement;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import ym.ecrm.core.domain.base.BaseEntity;

/**
 * 资源类
 * @author Princess
 * @version 1.0
 */
@Entity
@Table(name="t_resource")
public class Resource extends BaseEntity{

	
	/**
	 * 资源类型
	 * 资源的类型主要有：
	 * 功能模块（对应菜单/子菜单和URL等）、操作（对应方法和操作等）
	 */
	private String type;
	/**
	 * 资源内容
	 */
	private String content;

	@ManyToMany(targetEntity=Authority.class,
			fetch=FetchType.EAGER,
			cascade = {CascadeType.PERSIST, CascadeType.MERGE},
            mappedBy="resources")
    private Set<Authority> authorities = new HashSet<Authority>();

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Set<Authority> getAuthorities() {
		return authorities;
	}

	public void setAuthorities(Set<Authority> authorities) {
		this.authorities = authorities;
	}

}
